﻿<script src="~/Scripts/ChurchControllers/ChurchMemberJobtitleAssignmentController.js"></script>
<div class="row" ng-controller="ChurchMemberJobtitleAssignmentController">
    <div class="search-bar collapsed">
        <div class="form-group">
            <div class="input-group input-group-lg">
                <input type="text" class="form-control" placeholder="Type to search..." ng-model="searchkey" ng-change="Search()">
                <span class="input-group-btn">
                    <button class="btn btn-square btn-lg btn-default no-shadow close-search-bar" type="button" ng-click="searchkey='';Search();"><i class="zmdi zmdi-close"></i></button>
                </span>
            </div>
        </div>
    </div>
    <div class="col-md-12">
        <div class="bg-white bs-0 mb-20 widget">
            <div class="custom-grid-header">
                <div class="custom-grid-name">
                    Church Member Jobtitle
                </div>
                <div class="custom-grid-menu">
                    <ul class="custom-grid-menu-ul pull-right">
                        <li class="custom-grid-menu-ul-li" ng-click="ChangeView()">
                            <a href="javascript:;" class="text-white"><i class="zmdi zmdi-card-membership"></i></a>
                        </li>
                        <li class="custom-grid-menu-ul-li dropdown">
                            <a href="javascript:;" class="dropdown-toggle text-white"><i class="zmdi zmdi-print"></i></a>
                            <ul class="dropdown-menu dropdown-menu-right animated flipInY" style="margin-top: 4px; padding: 0px; width: 220PX;">
                                <li class="sortmenu">
                                    <div class="sort-col-1"><i class="zmdi zmdi-print"></i></div>
                                    <div class="sort-col-2"><a target="_blank" href="Members/PrintFamilyReports">Print All Family</a></div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu">
                                    <div class="sort-col-1"><i class="zmdi zmdi-print"></i></div>
                                    <div class="sort-col-2"><a target="_blank" href="Members/PrintFamilyWithMembersReports">Print Family and Members</a></div>
                                    <div class="clearfix"></div>
                                </li>
                            </ul>
                        </li>
                        <li class="custom-grid-menu-ul-li" ng-click="toggle('add','')">
                            <a href="javascript:;" class="text-white"><i class="fa fa-plus-circle"></i></a>
                        </li>
                        <li class="custom-grid-menu-ul-li dropdown">
                            <a href="javascript:;" class="dropdown-toggle text-white"><i class="zmdi zmdi-sort"></i></a>
                            <ul class="dropdown-menu dropdown-menu-right animated flipInY" style="margin-top: 4px; padding: 0px; width: 220PX;">
                                <li class="sortmenu" ng-click="sortby='DEFAULT';sort()" ng-class="{sortactive:sortby=='DEFAULT'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Default</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='NAME';sort()" ng-class="{sortactive:sortby=='NAME'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Name</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='EMAIL';sort()" ng-class="{sortactive:sortby=='EMAIL'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Email</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='PHONE';sort()" ng-class="{sortactive:sortby=='PHONE'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Phone</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='REFNO';sort()" ng-class="{sortactive:sortby=='REFNO'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Refference Number</div>
                                    <div class="clearfix"></div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                    <div class="clearfix"></div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="widget-body">
                <div class="row">
                    <div class="col-md-12" ng-show="viewmode=='TABLE'">
                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th style="width: 15%">NAME</th>
                                    <th style="width: 15%">BOARD NAME</th>
                                    <th style="width: 15%">JOBTITLE NAME</th>
                                    <th style="width: 10%">YEAR</th>
                                    <th style="width: 10%">FROM</th>
                                    <th style="width: 10%">TO</th>
                                    <th style="width: 10%">STATUS</th>
                                    <th style="width: 15%">ACTION&nbsp;</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="data in list">
                                    <td><span ng-if="data.Members.FullName!=''">{{data.Members.FullName}}</span><span ng-if="data.Members.FullName==''">{{data.Members.FirstName}}</span></td>
                                    <td>{{data.ChurchBoard.BoardName}} </td>
                                    <td>{{data.BoardJobtitle.JobtitleName}} </td>
                                    <td>{{data.EffectiveYear}}</td>
                                    <td>{{data.EffectiveFrom}}</td>
                                    <td>{{data.EffectiveTo}}</td>
                                    <td>{{data.CurrentStatus.ChurchWorkerStatusName}}</td>
                                    <td>
                                        <div class="btn-group-sm" role="group" aria-label="Second group">
                                            <button type="button" class="btn btn-info waves-effect" ng-click="toggle('edit',data.ChurchMemberJobtitleId);"><i class="fa fa-pencil"></i></button>
                                            <button type="button" class="btn btn-danger waves-effect" ng-click="delete(data.Members.FullName,data.ChurchMemberJobtitleId)"><i class="fa fa-trash"></i></button>
                                            <a class="btn btn-success waves-effect" href="ChurchWorkers/ChurchWorkerInfo?ChurchWorkerId={{data.ChurchMemberJobtitleId}}"><i class="fa fa-info-circle"></i></a>
                                            <a class="btn btn-purple waves-effect" target="_blank" href="ChurchWorkers/PrintChurchWorkerDetails?ChurchWorkerId={{data.ChurchMemberJobtitleId}}"><i class="zmdi zmdi-print"></i></a>
                                            @*<a class="btn btn-primary waves-effect" target="_blank" href="ChurchWorkers/ChurchWorkerInfo?ChurchWorkerId={{data.ChurchWorkerId}}"><i class="fa fa-print"></i></a>
                                                <a class="btn btn-warning waves-effect" title="Documents" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="fa fa-file-archive-o"></i></a>
                                                <a class="btn btn-gray waves-effect" title="Language" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-speaker"></i></a>
                                                <a class="btn btn-lime waves-effect" title="Designation" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-input-antenna"></i></a>
                                                <a class="btn btn-orange waves-effect" title="Family Details" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-local-florist"></i></a>
                                                <a class="btn btn-purple waves-effect" title="Left Organization" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-arrow-forward"></i></a>
                                                <a class="btn btn-info waves-effect" title="Activate/Deactivate" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-arrow-split"></i></a>
                                                <a class="btn btn-info waves-effect" title="Create Login" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-arrow-split"></i></a>*@
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="col-md-12" ng-show="viewmode=='CARD'">
                        <ul class="card">
                            <li ng-repeat="data in list">
                                <div class="card-container">
                                    <div class="card-container-row">
                                        <div class="card-image">
                                            <img class="media-object mo-lg img-circle mCS_img_loaded" src="/Uploads/uploaded/_productlogo.png" alt="">
                                        </div>
                                        <div class="card-details">
                                            <div class="card-details-row-1"><i class="fa fa-user"></i>{{data.FullName}}</div>
                                            <div class="card-details-row-2"><i class="fa fa-phone"></i>{{data.Phone}}</div>
                                            <div class="card-details-row-3"><i class="zmdi zmdi-email"></i>{{data.Email}}</div>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="card-action">
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div gridloader></div>
                    <div nodata></div>
                </div>
                <div ng-show="list.length > 0" style="padding-right: 10px; text-align: right;">
                    <div pagination="" page="currentPage" max-size="10" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-panel" tabindex="-1" id="Jobtitle" role="dialog" aria-labelledby="myPanelModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header bg-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">{{title}}</h4>
                </div>
                <form name="fromvalidate" novalidate>
                    <div class="modal-body">
                        <div class="form-group" >
                            <div custom-select="t as t.name for t in churchmembers | filter: { name: $searchTerm }" ng-model="churchmember" style="width:100%">
                                <div class="pull-left" style="width: 40px">
                                    <img src="~/Images/_ErrorImage.png" actual-image="{{ t.picture }}" style="width: 30px" on-error-src="~/Images/_LoadImage.jpg">
                                </div>
                                <div class="pull-left">
                                    <strong>{{ t.name }}</strong><br />
                                    <span>{{ t.phone }}</span>
                                    <span>{{ t.Email }}</span>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            Board Name
                            <select ng-model="jobtitle.ChurchBoardId"
                                    ng-options="obj.BoardId as obj.BoardName for obj in ChurchBoards"
                                    class="form-control" ng-required="true"></select>
                        </div>
                        <div class="form-group">
                            Jobtitle Name
                            <select ng-model="jobtitle.ChurchBoardJobtitleId"
                                    ng-options="obj.BoardJobtitleId as obj.JobtitleName for obj in ChurchBoardJobtitle"
                                    class="form-control" ng-required="true"></select>
                        </div>
                        <div class="form-group">
                            Effective Year
                            <select ng-model="jobtitle.EffectiveYear"
                                    ng-options="obj.yearid as obj.year for obj in years"
                                    class="form-control" ng-required="true"></select>
                        </div>
                        <div class="form-group">
                            Effective From
                            <input type="text" class="form-control" ng-model="jobtitle.EffectiveFrom" calendar ng-required="false">
                        </div>
                        <div class="form-group">
                            Effective To
                            <input type="text" class="form-control" calendar ng-model="jobtitle.EffectiveTo">
                        </div>
                        <div class="form-group">
                            Current Status
                            <select ng-model="jobtitle.CurrentStatusId"
                                    ng-options="obj.ChurchWorkerStatusId as obj.ChurchWorkerStatusName for obj in ChurchWorkerStatuss"
                                    class="form-control"
                                    ng-required="true"></select>
                        </div>
                        <label class="checkbox-inline checkbox-custom mr-15" ng-if="showcheckbox">
                            <input type="checkbox" value="remember" id="exampleCheckboxRemember" ng-model="jobtitle.CreateLogin">
                            <label for="exampleCheckboxRemember">Create Login </label>
                        </label>
                        <br />
                        <br />
                        <div class="form-group" ng-if="showcheckbox">
                            Email
                            <input type="text" class="form-control" ng-model="jobtitle.Email" ng-required="jobtitle.CreateLogin" ng-readonly="showcheckbox">
                        </div>
                        <div class="form-group">
                            Remarks
                            <textarea class="form-control" ng-model="jobtitle.Remarks"></textarea>
                        </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" ng-disabled="fromvalidate.$invalid || buttonstate" ng-click="save(modelstate);">Save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
